package com.sq.utils.config;
/*

import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.GlobalConfig;
import com.baomidou.mybatisplus.generator.config.PackageConfig;
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
import com.baomidou.mybatisplus.generator.config.rules.DbType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
*/

/**
 * @author
 * @date 2020-06-01 23:50
 */
public class CodeGenerator {
	/*public static void main(String[] args) {
		//全局配置
		GlobalConfig globalConfig=new GlobalConfig();
		String projectPath = System.getProperty("user.dir");
		globalConfig.setAuthor("SQ")//设置作者
				.setActiveRecord(true)//是否支持AR模式
				.setOutputDir(projectPath + "/src/main/java")   //生成文件的路径
				.setFileOverride(true)   //文件覆盖
				.setIdType(IdType.AUTO); //主键策略

		//数据源配置
		DataSourceConfig dataSourceConfig=new DataSourceConfig();
		dataSourceConfig.setDbType(DbType.MYSQL)
				.setUrl("jdbc:mysql://192.168.0.129:3306/world")
				.setDriverName("com.mysql.jdbc.Driver")
				.setUsername("root")
				.setPassword("root");

		//策略配置
		StrategyConfig strategyConfig=new StrategyConfig();
		strategyConfig.setCapitalMode(true)  //全局大写
				.setDbColumnUnderline(true) //数据库表名,字段名是否使用下划线
				.setNaming(NamingStrategy.underline_to_camel)  //数据库表映射到实体的命名策略
				.setInclude();//表名,不指定表名生成全部
		// .setTablePrefix("tbl_");//表前缀

		//包名策略
		PackageConfig packageConfig=new PackageConfig();
		packageConfig.setParent("com.sq")
				.setEntity("entity")
				.setMapper("dao")
				.setService("service")
				.setController("controller")
				.setXml("xml");

		AutoGenerator autoGenerator=new AutoGenerator();
		autoGenerator.setDataSource(dataSourceConfig)
				.setPackageInfo(packageConfig)
				.setGlobalConfig(globalConfig)
				.setStrategy(strategyConfig);
		autoGenerator.execute();

	}*/
}
